<template>
  <div>
    <Select v-model="currValue" filterable clearable :placeholder="placeholder">
      <Option 
        v-for="item in brandList" 
        :key="item.value"
        :label="item.text"
        :value="item.value.toString()">
      </Option>
    </Select>
  </div>
</template>

<script>
  import { mapGetters } from 'vuex'
  export default {
    props: {
      value: {
        type: [String, Number, Array],
        default: ''
      },
      placeholder:{
        type:String,
        default:'请选择品牌'
      }
    },
    data() {
      return {
        currValue: []
      }
    },
    mounted() {
      this.$store.dispatch('getBrandList', true)
    },
    computed: {
      ...mapGetters(['brandList'])
    },
    watch: {
      currValue(value) {
        this.$emit('input', value)
      },
      value(value) {
        this.currValue = value
      }
    }
  }
</script>